package com.xpgk.mvc.bsendMessage;

import javax.servlet.http.HttpServletRequest;

public class HttpRequestKit {
private static final String AJAX_HEADER_NAME = "x-requested-with";
	
	/**
	 * 判断ajax请求
	 */
	public static boolean isAjaxRequest(HttpServletRequest request)
	{
		String val = request.getHeader(AJAX_HEADER_NAME);
		return val != null && !val.equals("");
	}
	
	
	public static boolean isMutipartForm(HttpServletRequest request) 
	{
		return request != null 
				&& request.getContentType() != null 
				&& request.getContentType().contains("multipart/form-data");
	}
	
	
	public static boolean isUrlStartWith(HttpServletRequest request, String urlPrefix)
	{
		return request.getServletPath().startsWith(urlPrefix);
	}

}
